<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title></title>
		<script type="text/javascript">
			function fun1() {
				let div = document.querySelector("div");
				let input = document.querySelector("[type='text']");
				div.innerHTML = "文本框的值被修改为：" + input.value
			}
			function init(){
				let div = document.querySelector("div");
				div.oncopy = function() {
					alert("不允许复制")
					event.preventDefault()
				
				}
				let input = document.querySelector("[type='text']");
				input.addEventListener("paste", function() {
					alert("不允许粘贴")
					event.preventDefault()
				}, false)
			}
		</script>
	</head>
	<body onload="init()">
		姓名：<input type="text" onchange="fun1()">
		<hr>
		<div></div>
		
	</body>
</html>
